#ifndef ContextGL_h__
#define ContextGL_h__

#include "egl/egl.h"

enum ContextFlag {
    CF_RGB = 0,
    CF_ALPHA = 1,
    CF_DEPTH = 2,
    CF_STENCIL = 4
};

class ContextGL
{
public:
    static bool TestEGLError(char* pszLocation);

    virtual ~ContextGL() {}

    virtual bool Init(void* hWnd, int w, int h, int bpp, int multiSample, int flags =CF_RGB) =0;
    virtual void Release() =0;

    virtual void MakeCurrent();
    virtual void PresentContext();

    int     GetWidth() const { return w; }
    int     GetHeight() const { return h; }
protected:
    int flag;

    // EGL variables
    EGLDisplay			eglDisplay;
    EGLConfig			eglConfig;
    EGLSurface			eglSurface;
    EGLContext			eglContext;
    NativeWindowType	eglWindow;
    EGLint				pi32ConfigAttribs[128];

    int w, h;
};

#endif // ContextGL_h__
